import {
  SubConversionRateReq,
  SubConversionRateResp,
  TenantDistributionReq,
  TenantDistributionResp,
} from './model/sourceAnalysisModel';
import { operationHttp } from '/@/utils/http/axios';

enum Api {
  GET_SUBSCRIPTION_CONVERSION = '/v1/tenantSource/subConversion',
  GET_TENANT_DISTRIBUTION_BY_INDUSTRY = '/v1/tenantSource/industryDis',
  GET_TENANT_DISTRIBUTION_BY_LOCATION = '/v1/tenantSource/addressDis',
  GET_TENANT_DISTRIBUTION_BY_CHANNEL = '/v1/tenantSource/sourceDis',
}

export const getSubscriptionConversion = (params: SubConversionRateReq) => {
  return operationHttp.post<SubConversionRateResp>({
    url: Api.GET_SUBSCRIPTION_CONVERSION,
    params,
  });
};

export const getTenantDistributionByIndustry = (params: TenantDistributionReq) => {
  return operationHttp.get<TenantDistributionResp[]>({
    url: Api.GET_TENANT_DISTRIBUTION_BY_INDUSTRY,
    params,
  });
};

export const getTenantDistributionByLocation = (params: TenantDistributionReq) => {
  return operationHttp.get<TenantDistributionResp[]>({
    url: Api.GET_TENANT_DISTRIBUTION_BY_LOCATION,
    params,
  });
};

export const getTenantDistributionByChannel = (params: TenantDistributionReq) => {
  return operationHttp.get<TenantDistributionResp[]>({
    url: Api.GET_TENANT_DISTRIBUTION_BY_CHANNEL,
    params,
  });
};
